﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ProductManagement.aspx.cs" Inherits="Chinesys.UI.Products.ProductManagement" %>

<%@ Register Src="../Controls/ValidationSummary.ascx" TagName="ValidationSummary"
    TagPrefix="uc1" %>
<%@ MasterType VirtualPath="~/Site.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link type="text/css" rel="Stylesheet" href="../Styles/CustomStyles.css" />
</asp:Content>
<asp:Content ID="ProductManagementContent" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {

            $("a:contains('[Eliminar]')").click(
                function () {
                    return confirm('¿Esta seguro que desea eliminar el producto?');
                }
            );

            if ($('#hdnBizRulesException').val().length > 0) {
                var text = $('#hdnBizRulesException').val();
                $('#hdnBizRulesException').val('');
                $('#modalText').text(text);

                $("#modal").overlay({
                    top: 260,
                    mask: {
                        color: '#fff',
                        loadSpeed: 200,
                        opacity: 0.5
                    },
                    closeOnClick: false,
                    load: true
                });

            }

        });
    </script>
    <div>
        <asp:Label ID="lblInfo" CssClass="labelinfo" runat="server" Visible="false" />
        <asp:HiddenField ID="hdnBizRulesException" runat="server" ClientIDMode="Static" />
        <uc1:ValidationSummary ID="validationSummary" runat="server" />
    </div>
    <div id="modal">
        <div>
            <h2>
                Mensaje del Sistema</h2>
            <p id="modalText">
            </p>
            <button class="close">
                Cerrar
            </button>
        </div>
    </div>
    <asp:Panel ID="pnlList" runat="server">
        <asp:LinkButton ID="btnNewProduct" ForeColor="#4a3c8c" runat="server" Text="[Nuevo Producto]"
            OnClick="btnNewProduct_Click" />
        <br />
        <br />
        <div class="contentDiv">
            <asp:DataGrid ID="grdProducts" runat="server" AutoGenerateColumns="False" BackColor="White"
                BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal"
                OnItemCommand="grdProducts_ItemCommand">
                <AlternatingItemStyle BackColor="#F7F7F7" />
                <Columns>
                    <asp:TemplateColumn Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="ID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Id")%>' />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="Description" HeaderText="Descripcion" />
                    <asp:BoundColumn DataField="CategoryDescription" HeaderText="Categoria" />
                    <asp:BoundColumn DataField="SubCategoryDescription" HeaderText="Sub Categoria" />
                    <asp:BoundColumn DataField="Price" HeaderText="Precio(us)" DataFormatString="{0:C}" />
                    <asp:TemplateColumn>
                        <ItemTemplate>
                            <asp:Image ID="ImageSrc" Width="50" Height="50" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageSrc")%>' />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Active">
                        <ItemTemplate>
                            <asp:CheckBox ID="Active" Enabled="false" Width="50" Height="50" runat="server" Checked='<%# DataBinder.Eval(Container.DataItem, "Active")%>' />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:ButtonColumn Text="[Editar]" HeaderText="Editar" ButtonType="LinkButton" CommandName="cmdEditProduct" />
                </Columns>
                <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                <ItemStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" Mode="NumericPages" />
                <SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
            </asp:DataGrid>
        </div>
    </asp:Panel>
    <asp:Panel ID="pnlEditor" runat="server" Visible="false">
        <div class="editor">
            <h5>
                Datos del Producto</h5>
            <p>
                <asp:Label ID="lblName" AssociatedControlID="txtName" runat="server">Nombre:</asp:Label>
                <asp:TextBox ID="txtName" runat="server" />
            </p>
            <p>
                <asp:Label ID="lblDescription" AssociatedControlID="txtDecription" runat="server">Descripción:</asp:Label>
                <asp:TextBox ID="txtDecription" TextMode="MultiLine" runat="server" />
            </p>
            <p>
                <asp:Label ID="lblPriceInDolars" AssociatedControlID="txtPriceInDolars" runat="server">Precio(us):</asp:Label>
                <asp:TextBox ID="txtPriceInDolars" runat="server" />
            </p>
            <p>
                <asp:Label ID="lblCategory" AssociatedControlID="ddlCategory" runat="server">Categoria:</asp:Label>
                <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged">
                </asp:DropDownList>
            </p>
            <p>
                <asp:Label ID="lblSubCategory" AssociatedControlID="ddlSubCategory" runat="server">Sub Categoria:</asp:Label>
                <asp:DropDownList ID="ddlSubCategory" runat="server">
                </asp:DropDownList>
            </p>
            <p>
                <asp:Label ID="lblActive" AssociatedControlID="chkActive" runat="server">Active:</asp:Label>
                <asp:CheckBox ID="chkActive" runat="server" />
            </p>
            <p>
                <asp:Label ID="lblFileUpload" AssociatedControlID="fileUpload" runat="server">Subir Imagen:</asp:Label>
                <asp:FileUpload ID="fileUpload" ClientIDMode="Static" runat="server" />
            </p>
            <p>
                <asp:Image ID="imgImage" runat="server" ClientIDMode="Static" Height="200" Width="200" />
            </p>
        </div>
        <div class="editorbuttons">
            <asp:Button ID="btnSave" Text="Guardar" runat="server" Width="100" OnClick="btnSave_Click" />
            <asp:Button ID="btnCancel" Text="Cancelar" runat="server" Width="100" OnClick="btnCancel_Click" />
        </div>
    </asp:Panel>
</asp:Content>
